/**
 * 
 */
package com.thor.palmmall.rest.sales.input.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.sales.input.AContractProducts;
import com.thor.palmmall.spi.basic.SContractProducts;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class AContractProductsConverter implements Converter<SContractProducts, AContractProducts> {

  public static AContractProductsConverter getInstance() {
    if (instance == null)
      instance = new AContractProductsConverter();
    return instance;
  }

  private static AContractProductsConverter instance;

  private AContractProductsConverter() {
  }

  @Override
  public AContractProducts convert(SContractProducts source) {
    if (source == null) {
      return null;
    }
    AContractProducts target = new AContractProducts();
    target.setCode(source.getCode());
    target.setName(source.getName());
    target.setUuid(source.getUuid());
    target.setPrice(source.getPrice());
    target.setVersion(source.getVersion());
    target.setProperties(source.getProperties());
    return target;
  }

}
